package com.ruoyi.back.controller

import com.ruoyi.app.common.Data
import com.ruoyi.app.common.PageData
import com.ruoyi.back.domain.dto.CheckTemplateDto
import com.ruoyi.back.domain.dto.TemplateReportSearchDto
import com.ruoyi.back.domain.vo.ResolveStatusSumVo
import com.ruoyi.back.domain.vo.TemplateReportListVo
import com.ruoyi.back.service.TemplateReportService
import io.swagger.annotations.Api
import io.swagger.annotations.ApiOperation
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.PathVariable
import org.springframework.web.bind.annotation.PostMapping
import org.springframework.web.bind.annotation.RequestBody
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController

@RestController
@RequestMapping("system/templateReport")
@Api(tags = ["模板举报"])
class TemplateReportController {

    @Autowired
    private lateinit var templateReportService: TemplateReportService


    @ApiOperation("模板举报分页")
    @GetMapping("page")
    fun templateReportPage(templateReportSearchDto: TemplateReportSearchDto): PageData<TemplateReportListVo> =
        templateReportService.templateReportPage(templateReportSearchDto)

    @ApiOperation("处理状态统计")
    @GetMapping("resolveStatusSum")
    fun resolveStatusSum(): Data<ResolveStatusSumVo> = templateReportService.resolveStatusSum()

    @ApiOperation("审核模板举报")
    @PostMapping("checkTemplateReport")
    fun checkTemplateReport(@RequestBody checkTemplateDto: CheckTemplateDto): Data<Boolean> =
        templateReportService.checkTemplateReport(checkTemplateDto)

    @ApiOperation("移除模板举报")
    @GetMapping("remove/{ids}")
    fun removeCheckTemplate(@PathVariable ids: String): Data<Boolean> =
        templateReportService.removeCheckTemplate(ids)
}